<script>
import RenderItem from "./RenderItem.vue";

export default {
  props: {
    data: Array,
  },
  methods: {
    renderTree(list, id) {
      return list.map((item) => {
        return (
          <RenderItem item={item} id={id}>
            {item.children && item.children.length
              ? this.renderTree(item.children, item.id)
              : null}
          </RenderItem>
        );
      });
    },
  },
  render: function (h) {
    return h("div", this.renderTree(this.data));
  },
};
</script>
